{include file="header.htm" /}
<body class="bodystyle" style="overflow-y: scroll; cursor: default; -moz-user-select: inherit;">
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page min-hg-c-20"> 
    <div class="fixed-bar">
        <div class="item-title">
            <a class="back_xin" href='{:weapp_url("Verify/Verify/verify_staff")}' title="返回"><i class="iconfont e-fanhui"></i></a>
            <div class="subject">
                <h3>编辑核销员</h3>
                <h5></h5>
            </div>
        </div>
    </div>
    <form class="form-horizontal" id="postForm">
        <input type="hidden" name="staff_id" value="{$staff.staff_id}">
        <div class="ncap-form-default">
            <dl class="row">
                <dt class="tit"><label><em>*</em>所属门店</label></dt>
                <dd class="opt" style="width: auto;">
                    <select name="store_id" id="store_id">
                        {volist name="$storeList" id="vo"}
                        <option value="{$vo.store_id}" {eq name="$vo.store_id" value="$staff.store_id"} selected {/eq}>{$vo.store_name}</option>
                        {/volist}
                    </select>
                </dd>
            </dl>

            <dl class="row">
                <dt class="tit"><label><em>*</em>核销员选择</label></dt>
                <dd class="opt">
                    <input type="hidden" name="users_id" id="users_id" value="{$staff.users_id}">
                    <img style="float: unset; border: 1px solid #e9edef; width: 24px; height: 24px; border-radius: 50%;" src="{$staff.head_pic|get_default_pic=###}"> &nbsp; 
                    <a href="javascript:void(0);" data-href="{:url('Member/users_edit',['id'=>$staff.users_id])}" onclick="openFullframe(this, '会员资料','100%','100%');">{$staff.nickname}</a>
                </dd>
            </dl>

            <dl class="row">
                <dt class="tit"><label for="staff_name"><em>*</em>核销员名称</label></dt>
                <dd class="opt" style="width: auto;">
                    <input type="text" name="staff_name" id="staff_name" value="{$staff.staff_name}" class="input-txt" placeholder="请输入核销员名称" autocomplete="off">
                </dd>
            </dl>

            <dl class="row">
                <dt class="tit"><label for="staff_phone"><em>*</em>核销员手机</label></dt>
                <dd class="opt" style="width: auto;">
                    <input type="text" name="staff_phone" id="staff_phone" value="{$staff.staff_phone}" class="input-txt" placeholder="请输入核销员手机" autocomplete="off" maxlength="11" onkeyup="this.value=this.value.replace(/[^\d]/g, '');" onpaste="this.value=this.value.replace(/[^\d]/g, '');">
                </dd>
            </dl>

            <dl class="row">
                <dt class="tit"><label>核销员状态</label></dt>
                <dd class="opt">
                    <label class="curpoin">
                        <input type="radio" name="staff_status" value="1" {eq name="$staff.staff_status" value="1"} checked="checked" {/eq}>启用
                    </label>
                    &nbsp;
                    <label class="curpoin">
                        <input type="radio" name="staff_status" value="2" {eq name="$staff.staff_status" value="2"} checked="checked" {/eq}>禁用
                    </label>
                </dd>
            </dl>

            <div class="bot">
                <a href="JavaScript:void(0);" onclick="saveStore();" class="ncap-btn-big ncap-btn-green">保存</a>
            </div>
        </div>
    </form>
</div>

<script type="text/javascript">
    // 保存核销员
    function saveStore() {
        if ($('#store_id').val() == 0) {
            showErrorMsg('请选择所属门店');
            return false;
        } else if ($('#users_id').val() == 0) {
            $('#select_users').click();
            // showErrorMsg('请选择核销会员');
            return false;
        } else if ($('#staff_name').val() == '') {
            showErrorMsg('请输入核销员名称');
            $('#staff_name').focus();
            return false;
        } else if ($('#staff_phone').val() == '') {
            showErrorMsg('请输入核销员手机');
            $('#staff_phone').focus();
            return false;
        }

        layer_loading('正在处理');
        $.ajax({
            type: 'post',
            url : "{:weapp_url('Verify/Verify/verify_staff_edit', ['_ajax'=>1])}",
            data: $('#postForm').serialize(),
            dataType: 'json',
            success: function(res) {
                layer.closeAll();
                if (res.code == 1) {
                    layer.msg(res.msg, {icon: 1, shade: layer_shade, time: 1000}, function() {
                        window.location.href = res.url;
                    });
                } else {
                    showErrorMsg(res.msg);
                }
            },
            error: function(e) {
                layer.closeAll();
                showErrorAlert(e.responseText);
            }
        });
    }
</script>
{include file="footer.htm" /}